export ANDROID_ROOT=/home/test/source/jb_rel_qrd
WORK_DIR=`pwd`
MPIMG_PATH=$WORK_DIR/MPIMG/
APIMG_PATH=$WORK_DIR/APIMG/
export OUT_HOST_ROOT=$ANDROID_ROOT/out/host/linux-x86
export KEY_NAME=$ANDROID_ROOT/build/target/product/security/testkey 
export TARGET_OUT=$ANDROID_ROOT/out/target/product/msm8625
export TMP_PACKAGE=$TARGET_OUT/ota_tmp_package.zip

cd $ANDROID_ROOT

if [ ! -d RADIO ]; then
mkdir -p RADIO
fi

cat $MPIMG_PATH/amss.mbn > RADIO/AMSS.mbn
cat $MPIMG_PATH/amsshd.mbn > RADIO/AMSSHD.mbn
dd if=$MPIMG_PATH/oemsblhd.mbn of=RADIO/OEMSBL.bin ibs=512 conv=sync
cat $MPIMG_PATH/oemsbl.mbn >> RADIO/OEMSBL.bin
cat $MPIMG_PATH/qcsbl.mbn > RADIO/QCSBL.bin
cat $MPIMG_PATH/qcsblhd_cfgdata.mbn > RADIO/QCSBLHD.bin
dd if=$APIMG_PATH/emmc_appsboothd.mbn of=RADIO/APPSBOOT.bin ibs=512 conv=sync
cat $APIMG_PATH/emmc_appsboot.mbn >> RADIO/APPSBOOT.bin

zip -ur $TMP_PACKAGE RADIO
./build/tools/releasetools/ota_from_target_files -v  -x pagesize=4096 -p $ANDROID_ROOT/out/host/linux-x86  -d MMC -f 1 -k $ANDROID_ROOT/build/target/product/security/testkey $TMP_PACKAGE $WORK_DIR/out.zip
rm -rf RADIO
cd $WORK_DIR

